﻿using BenchmarkDotNet.Attributes;
using System.Security.Cryptography;
using System.IO;
using System;
using SearchText;
using SearchAlgorithms.extention;


namespace SearchAlgorithmBenchmarks
{
    [Config(typeof(MyConfig))]
    [MemoryDiagnoser]

    [Orderer(BenchmarkDotNet.Order.SummaryOrderPolicy.FastestToSlowest)]
    [RankColumn]

    public class ComparerBenchmarks
    {
        static string FileAPath = "C:\\Users\\leomojys\\Desktop\\2.png";
        static string FileBPath = "C:\\Users\\leomojys\\Desktop\\3.png";

        byte[] FileAData = File.ReadAllBytes(FileAPath);
        byte[] FileBData = File.ReadAllBytes(FileBPath);


        [Benchmark]
        public void CompareWithSequence() => CompareExtension.CompareWithSequence(FileAData, FileBData);

        [Benchmark]
        public void CompareWithSequenceSpan() => CompareExtension.CompareWithSequence(FileAData.AsSpan(), FileBData.AsSpan());

        [Benchmark]
        public void Comparison() => CompareExtension.Comparison(FileAData, FileBData);

        [Benchmark]
        public void ComparisonSpan() => CompareExtension.Comparison(FileAData.AsSpan(), FileBData.AsSpan());

        //[Benchmark]
        //public void CompareWithHash256() => CompareExtension.CompareWithHash(FileAData, FileBData, SHA256.Create());

        //[Benchmark]
        //public void CompareWithHash256Span() => CompareExtension.CompareWithHashAsSpan(FileAData, FileBData, SHA256.Create());

        //[Benchmark]
        //public void CompareWithHash512() => CompareExtension.CompareWithHash(FileAData, FileBData, SHA512.Create());

        //[Benchmark]
        //public void CompareWithHash512Span() => CompareExtension.CompareWithHashAsSpan(FileAData, FileBData, SHA512.Create());
    }
    
}
